package com.music.service.albums.mapper;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.springframework.jdbc.core.RowMapper;

import com.music.service.albums.beans.Album;
import com.music.service.albums.constants.AlbumState;

public class AlbumMapper implements RowMapper {

	public Object mapRow(ResultSet pResultSet, int pArg1) throws SQLException {
		Album album = new Album();
		album.setAlbumId(pResultSet.getLong("album_id"));
		album.setAlbumName(pResultSet.getString("album_name"));
		album.setOwnerId(pResultSet.getLong("created_member_id"));
		album.setCreationDate(pResultSet.getDate("creation_date"));
		album.setLastUpdateDate(pResultSet.getDate("last_update_date"));
		album.setState(AlbumState.getAlbumState(pResultSet.getString("state")));
		return album;
	}

}
